package com.tianliangedu.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.tianliangedu.manager.db.WeiBoDBManager;

/**
 * 注解声明，该类为Controller类 并自动加载所需要的其它类
 */
@Controller
public class DBController {
	@Autowired
	private WeiBoDBManager weiBoDBManager;
	
	@RequestMapping("/hotwords")
	String getHotWords(ModelMap modelMap) {
		List<Map<String, Object>> list = weiBoDBManager.getHotWordsList(null);
		modelMap.put("result", list);
		return "weibo_hotwords";
	}
	
	// 主方法，像一般的Java类一般去右击run as application时候，执行该方法
	public static void main(String[] args) throws Exception {
		SpringApplication.run(DBController.class, args);
	}
}
